#include "button.h"

namespace igslib
{
	IButtonManager* CButtonManager::instance = 0;
	IButtonManager* CButtonManager::GetInstance() 
	{
		if ( instance == 0 )
		{
			instance = new CButtonManager();
		}
		return instance ;
	}
    IGPIOButton* CButtonManager::NewGPIOButton()
    {
        IGPIOButton* rtn = nullptr;
        rtn = new CGPIOButton();
        cpns.insert(rtn);
        return rtn;
    }
    void CButtonManager::Update()
    {
        for(auto& each:cpns)
        {
            CButton* base_btn = dynamic_cast<CButton*>(each);
            base_btn->Update();
        }
    }
}

extern "C"{
	igslib::IButtonManager* GetButtonManagerInstance()
	{
		return igslib::CButtonManager::GetInstance();
	}
}
